package casedemo;

public class Test01 {

    public static void main(String[] args) {
        //todo:买飞机票
        double price = buyTicket(1000, 12, "经济舱");
        System.out.println("优惠价" + price);

    }

    public static double buyTicket(double price, int month, String type) {

        //判断淡旺季
        if (month >= 5 && month <= 10) {
            //旺季
            switch (type) {
                case "头等舱":
                    price *= 0.9;
                    break;
                case "经济舱":
                    price *= 0.85;
                    break;
            }
        } else {
            //淡季
            switch (type) {
                case "头等舱":
                    price *= 0.7;
                    break;
                case "经济舱":
                    price *= 0.65;
                    break;
            }
        }

        return price;
    }
}
